package com.alex.xmlyfm.entities.albumdetail;

import android.os.Parcel;
import android.os.Parcelable;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by
 * Author: alex
 * Email:
 * Date: 15-10-23.
 */
public class AlbumDetailTrack implements Parcelable {




    private int trackId;
    private int uid;
    private String playUrl64;
    private String playUrl32;
    private String downloadUrl;
    private String playPathAacv164;
    private String playPathAacv224;
    private String downloadAacUrl;
    private String title;
    private double duration;
    private int processState;
    private long createdAt;
    private String coverSmall;
    private String coverLarge;
    private String nickname;
    private String smallLogo;
    private int userSource;
    private int albumId;
    private String albumTitle;
    private String albumImage;
    private int orderNum;
    private int opType;
    private boolean isPublic;
    private int likes;
    private int playtimes;
    private int comments;
    private int shares;
    private int status;
    private int downloadSize;
    private int downloadAacSize;

    private boolean isPlay;

    public boolean isPublic() {
        return isPublic;
    }

    public void setIsPlay(boolean isPlay) {
        this.isPlay = isPlay;
    }



    public boolean isPlay() {
        return isPlay;
    }

    public AlbumDetailTrack() {
    }

    protected AlbumDetailTrack(Parcel in) {
        trackId = in.readInt();
        uid = in.readInt();
        playUrl64 = in.readString();
        playUrl32 = in.readString();
        downloadUrl = in.readString();
        playPathAacv164 = in.readString();
        playPathAacv224 = in.readString();
        downloadAacUrl = in.readString();
        title = in.readString();
        duration = in.readDouble();
        processState = in.readInt();
        createdAt = in.readLong();
        coverSmall = in.readString();
        coverLarge = in.readString();
        nickname = in.readString();
        smallLogo = in.readString();
        userSource = in.readInt();
        albumId = in.readInt();
        albumTitle = in.readString();
        albumImage = in.readString();
        orderNum = in.readInt();
        opType = in.readInt();
        isPublic = in.readByte() != 0;
        likes = in.readInt();
        playtimes = in.readInt();
        comments = in.readInt();
        shares = in.readInt();
        status = in.readInt();
        downloadSize = in.readInt();
        downloadAacSize = in.readInt();
    }

    public static final Creator<AlbumDetailTrack> CREATOR = new Creator<AlbumDetailTrack>() {
        @Override
        public AlbumDetailTrack createFromParcel(Parcel in) {
            return new AlbumDetailTrack(in);
        }

        @Override
        public AlbumDetailTrack[] newArray(int size) {
            return new AlbumDetailTrack[size];
        }
    };

    /**
     * trackId : 7996526
     * uid : 2629577
     * playUrl64 : http://fdfs.xmcdn.com/group8/M08/52/5B/wKgDYFW2envSiMSyATE0a1NxlgI220.mp3
     * playUrl32 : http://fdfs.xmcdn.com/group10/M07/52/53/wKgDZ1W2ekPBgmC_AJiaTKE52lI991.mp3
     * downloadUrl : http://download.xmcdn.com/group10/M07/52/50/wKgDaVW2elHirDiwAJ5aSy_6VKU544.aac
     * playPathAacv164 : http://audio.xmcdn.com/group10/M07/52/51/wKgDaVW2emmhQ0h1ATSDth0VxeI658.m4a
     * playPathAacv224 : http://audio.xmcdn.com/group10/M07/52/53/wKgDZ1W2ejeTU5ytAHXCHrwQF60039.m4a
     * downloadAacUrl : http://audio.xmcdn.com/group10/M07/52/53/wKgDZ1W2ejeTU5ytAHXCHrwQF60039.m4a
     * title : 段子来了丨飞机一日千百里，电梯一屁几十米50728（采采）
     * duration : 2500.21
     * processState : 2
     * createdAt : 1438022270000
     * coverSmall : http://fdfs.xmcdn.com/group7/M07/53/26/wKgDWlW26MGQ8SKQAAFrgB20PU8213_mobile_small.jpg
     * coverLarge : http://fdfs.xmcdn.com/group7/M07/53/26/wKgDWlW26MGQ8SKQAAFrgB20PU8213_mobile_large.jpg
     * nickname : 枕边疯电台
     * smallLogo : http://fdfs.xmcdn.com/group3/M00/64/F8/wKgDslJ68TnQpnVPAAU-A1zGGqI128_mobile_small.jpg
     * userSource : 1
     * albumId : 203355
     * albumTitle : 段子来了
     * albumImage : http://fdfs.xmcdn.com/group5/M03/A6/D8/wKgDtlR1MD_T1DQHAANqZDyk48s720_mobile_small.jpg
     * orderNum : 99999999
     * opType : 1
     * isPublic : true
     * likes : 1126
     * playtimes : 80978
     * comments : 695
     * shares : 0
     * status : 1
     * downloadSize : 10377803
     * downloadAacSize : 7717406
     */

    public void parseJSON(JSONObject json) throws JSONException {
        trackId = json.getInt("trackId");
        uid = json.getInt("uid");
        playPathAacv164 = json.getString("playPathAacv164");
        title = json.getString("title");
        nickname = json.getString("nickname");
        coverLarge = json.getString("coverLarge");
        albumTitle = json.getString("albumTitle");
        albumImage = json.getString("albumImage");
        albumId = json.getInt("albumId");
        playtimes = json.getInt("playtimes");
        comments = json.getInt("comments");
    }

    public void setTrackId(int trackId) {
        this.trackId = trackId;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public void setPlayUrl64(String playUrl64) {
        this.playUrl64 = playUrl64;
    }

    public void setPlayUrl32(String playUrl32) {
        this.playUrl32 = playUrl32;
    }

    public void setDownloadUrl(String downloadUrl) {
        this.downloadUrl = downloadUrl;
    }

    public void setPlayPathAacv164(String playPathAacv164) {
        this.playPathAacv164 = playPathAacv164;
    }

    public void setPlayPathAacv224(String playPathAacv224) {
        this.playPathAacv224 = playPathAacv224;
    }

    public void setDownloadAacUrl(String downloadAacUrl) {
        this.downloadAacUrl = downloadAacUrl;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void setDuration(double duration) {
        this.duration = duration;
    }

    public void setProcessState(int processState) {
        this.processState = processState;
    }

    public void setCreatedAt(long createdAt) {
        this.createdAt = createdAt;
    }

    public void setCoverSmall(String coverSmall) {
        this.coverSmall = coverSmall;
    }

    public void setCoverLarge(String coverLarge) {
        this.coverLarge = coverLarge;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public void setSmallLogo(String smallLogo) {
        this.smallLogo = smallLogo;
    }

    public void setUserSource(int userSource) {
        this.userSource = userSource;
    }

    public void setAlbumId(int albumId) {
        this.albumId = albumId;
    }

    public void setAlbumTitle(String albumTitle) {
        this.albumTitle = albumTitle;
    }

    public void setAlbumImage(String albumImage) {
        this.albumImage = albumImage;
    }

    public void setOrderNum(int orderNum) {
        this.orderNum = orderNum;
    }

    public void setOpType(int opType) {
        this.opType = opType;
    }

    public void setIsPublic(boolean isPublic) {
        this.isPublic = isPublic;
    }

    public void setLikes(int likes) {
        this.likes = likes;
    }

    public void setPlaytimes(int playtimes) {
        this.playtimes = playtimes;
    }

    public void setComments(int comments) {
        this.comments = comments;
    }

    public void setShares(int shares) {
        this.shares = shares;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public void setDownloadSize(int downloadSize) {
        this.downloadSize = downloadSize;
    }

    public void setDownloadAacSize(int downloadAacSize) {
        this.downloadAacSize = downloadAacSize;
    }

    public int getTrackId() {
        return trackId;
    }

    public int getUid() {
        return uid;
    }

    public String getPlayUrl64() {
        return playUrl64;
    }

    public String getPlayUrl32() {
        return playUrl32;
    }

    public String getDownloadUrl() {
        return downloadUrl;
    }

    public String getPlayPathAacv164() {
        return playPathAacv164;
    }

    public String getPlayPathAacv224() {
        return playPathAacv224;
    }

    public String getDownloadAacUrl() {
        return downloadAacUrl;
    }

    public String getTitle() {
        return title;
    }

    public double getDuration() {
        return duration;
    }

    public int getProcessState() {
        return processState;
    }

    public long getCreatedAt() {
        return createdAt;
    }

    public String getCoverSmall() {
        return coverSmall;
    }

    public String getCoverLarge() {
        return coverLarge;
    }

    public String getNickname() {
        return nickname;
    }

    public String getSmallLogo() {
        return smallLogo;
    }

    public int getUserSource() {
        return userSource;
    }

    public int getAlbumId() {
        return albumId;
    }

    public String getAlbumTitle() {
        return albumTitle;
    }

    public String getAlbumImage() {
        return albumImage;
    }

    public int getOrderNum() {
        return orderNum;
    }

    public int getOpType() {
        return opType;
    }

    public boolean getIsPublic() {
        return isPublic;
    }

    public int getLikes() {
        return likes;
    }

    public int getPlaytimes() {
        return playtimes;
    }

    public int getComments() {
        return comments;
    }

    public int getShares() {
        return shares;
    }

    public int getStatus() {
        return status;
    }

    public int getDownloadSize() {
        return downloadSize;
    }

    public int getDownloadAacSize() {
        return downloadAacSize;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(trackId);
        dest.writeInt(uid);
        dest.writeString(playUrl64);
        dest.writeString(playUrl32);
        dest.writeString(downloadUrl);
        dest.writeString(playPathAacv164);
        dest.writeString(playPathAacv224);
        dest.writeString(downloadAacUrl);
        dest.writeString(title);
        dest.writeDouble(duration);
        dest.writeInt(processState);
        dest.writeLong(createdAt);
        dest.writeString(coverSmall);
        dest.writeString(coverLarge);
        dest.writeString(nickname);
        dest.writeString(smallLogo);
        dest.writeInt(userSource);
        dest.writeInt(albumId);
        dest.writeString(albumTitle);
        dest.writeString(albumImage);
        dest.writeInt(orderNum);
        dest.writeInt(opType);
        dest.writeByte((byte) (isPublic ? 1 : 0));
        dest.writeInt(likes);
        dest.writeInt(playtimes);
        dest.writeInt(comments);
        dest.writeInt(shares);
        dest.writeInt(status);
        dest.writeInt(downloadSize);
        dest.writeInt(downloadAacSize);
    }
}
